package lab02.test13;

public class Gymnastics extends ComputerAverage{
    double s1;
    double s2;
    double s3;
    double s4;
    double s5;
    double max = 0;
    double min = 0;
    int kmax;
    int kmin;

    @Override
    double average() {
        double[] score={s1,s2,s3,s4,s5};
        for (int i = 0 ;i <= 4; i ++) {
            if (score[i] > max) {
                max = score[i];
                kmax = i;
            } else if (score[i] < min){
                min = score[i];
                kmin = i;
            }
        }
        score[kmax] = 0;
        score[kmin] = 0;

        double sum = 0;

        for (int i = 0;i <4 ;i++){
            sum = sum +score[i];
        }

        sum = sum/3;
        return sum;
    }
}
